#include <string.h>

#define maxof2(X,Y) (((Y)>(X))?(Y):(X))
#define minof2(X,Y) (((Y)<(X))?(Y):(X))

typedef struct{
	double *W;
	double pobj;
	int m, n;
}TRACERET;

typedef struct{
	char registry[30];
	double tol;
	int freq;
	int m;
	int n;
	int p;
}TRACEOPTS;


void setTRACEOPTStol(double tol, TRACEOPTS* opt);

void setTRACEOPTSfreq(double freq, TRACEOPTS* opt);

int rankofMat(double* A,int m, int n);

void dcopyMatrixTranspose(int m,int n, double* A, int lda, double *B, int ldb);

void slepQRFactorize(char trans,int m, int n,double *a, double *q, double *r);

void slepInvert(int n,double *A);

int largestMagnitude(int n, double *wReal,double *wImag);

void slepSVD(int m, int n, double *A, int lda, double* sing, double *U,int ldu, double *VT, int ldvt);

double myTrace2(char transa,char transb, int m, int n, double *A, int lda, double *B, int ldb);

double myTrace3(char transa, int m, int n, int k, double* A, int lda, double* B, int ldb, double* C, int ldc);

double slepNuclearNorm(int m, int n, double *A, int lda);